# -*- coding: utf-8 -*-


class UserMixin:
    is_anonymous = False
    is_oauth_authenticated = True
    is_admin = False

    @property
    def is_binding(self):
        # 简单判断
        # 匿名用户为非绑定用户
        # 其它用户时绑定用户
        return not self.is_anonymous

    def is_active(self):
        return True


class AnonymousUser(UserMixin):
    is_anonymous = True
    is_oauth_authenticated = False

    def __init__(self, oauth=False):
        self.is_oauth_authenticated = oauth


class User(UserMixin):
    # user不从数据库获取时所采用的模型

    def __init__(self, **kwargs):
        for name, val in kwargs.items():
            setattr(self, name, val)